package com.monitor.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.monitor.entity.ErpTpmsTireInformation;
import com.monitor.service.ErpTpmsTireInformationService;
import com.monitor.util.Result;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/information")
@Api(description="客户轮胎报警值设置")
public class ErpTpmsTireInformationController {
	@Autowired
	private ErpTpmsTireInformationService erpTpmsTireInformationService;
	
	@RequestMapping("/selectList")
	@ApiOperation("查询所有系统报警值参数")
	public Result<List<ErpTpmsTireInformation>> selectList(int custId){
		return erpTpmsTireInformationService.selectList(custId);
	}
	
	@RequestMapping("/selectById")
	@ApiOperation("根据id查询报警值详情")
	@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "int", paramType = "query")
	public Result<ErpTpmsTireInformation> selectById(int id) {
		ErpTpmsTireInformation tpms=erpTpmsTireInformationService.selectById(id);
		return new Result<ErpTpmsTireInformation>(tpms,1);
	}
	
	@RequestMapping("/addInformation")
	@ApiOperation("添加系统报警值参数")
	@ApiImplicitParams({
         @ApiImplicitParam(name = "pid", value = "客户id", required = false, dataType = "int", paramType = "query"),
         @ApiImplicitParam(name = "brand", value = "品牌", required = false, dataType = "String", paramType = "query"),
         @ApiImplicitParam(name = "specifications", value = "规格", required = false, dataType = "String", paramType = "query"),
         @ApiImplicitParam(name = "model", value = "型号", required = false, dataType = "String", paramType = "query"),
         @ApiImplicitParam(name = "place", value = "产地", required = false, dataType = "String", paramType = "query"),
         @ApiImplicitParam(name = "speed", value = "速度", required = false, dataType = "Double", paramType = "query"),
         @ApiImplicitParam(name = "pressure", value = "最大胎压", required = false, dataType = "Double", paramType = "query"),
         @ApiImplicitParam(name = "pressureSmall", value = "最小胎压", required = false, dataType = "Double", paramType = "query"),
         @ApiImplicitParam(name = "voltageSmall", value = "最小电压", required = false, dataType = "Double", paramType = "query"),
         @ApiImplicitParam(name = "temperature", value = "最大温度", required = false, dataType = "Double", paramType = "query")
	})
	public Result<Integer> addInformation(ErpTpmsTireInformation forma){
		return erpTpmsTireInformationService.addInformation(forma);
	}
	
	@RequestMapping("/updateInformation")
	@ApiOperation("修改系统报警值参数")
	@ApiImplicitParams({
		 @ApiImplicitParam(name = "id", value = "id", required = false, dataType = "int", paramType = "query"),
         @ApiImplicitParam(name = "pid", value = "客户id", required = false, dataType = "int", paramType = "query"),
         @ApiImplicitParam(name = "brand", value = "品牌", required = false, dataType = "String", paramType = "query"),
         @ApiImplicitParam(name = "specifications", value = "规格", required = false, dataType = "String", paramType = "query"),
         @ApiImplicitParam(name = "model", value = "型号", required = false, dataType = "String", paramType = "query"),
         @ApiImplicitParam(name = "place", value = "产地", required = false, dataType = "String", paramType = "query"),
         @ApiImplicitParam(name = "speed", value = "速度", required = false, dataType = "Double", paramType = "query"),
         @ApiImplicitParam(name = "pressure", value = "最大胎压", required = false, dataType = "Double", paramType = "query"),
         @ApiImplicitParam(name = "pressureSmall", value = "最小胎压", required = false, dataType = "Double", paramType = "query"),
         @ApiImplicitParam(name = "voltageSmall", value = "最小电压", required = false, dataType = "Double", paramType = "query"),
         @ApiImplicitParam(name = "temperature", value = "最大温度", required = false, dataType = "Double", paramType = "query")
	})
	public Result<Integer> updateInformation(ErpTpmsTireInformation forma){
		return erpTpmsTireInformationService.updateInformation(forma);
	}
	
	@RequestMapping("/updateAll")
	@ApiOperation("修改所有系统报警值参数")
	@ApiImplicitParams({
		@ApiImplicitParam(name = "pid", value = "客户id", required = false, dataType = "int", paramType = "query"),
         @ApiImplicitParam(name = "speed", value = "速度", required = false, dataType = "Double", paramType = "query"),
         @ApiImplicitParam(name = "pressure", value = "最大胎压", required = false, dataType = "Double", paramType = "query"),
         @ApiImplicitParam(name = "pressureSmall", value = "最小胎压", required = false, dataType = "Double", paramType = "query"),
         @ApiImplicitParam(name = "voltageSmall", value = "最小电压", required = false, dataType = "Double", paramType = "query"),
         @ApiImplicitParam(name = "temperature", value = "最大温度", required = false, dataType = "Double", paramType = "query")
	})
	public Result<Integer> updateAll(ErpTpmsTireInformation forma){
		return erpTpmsTireInformationService.updateAll(forma);
	}
	
	@RequestMapping("/equivalent")
	@ApiOperation("设置等同")
	@ApiImplicitParams({
         @ApiImplicitParam(name = "pid", value = "等同客户id", required = false, dataType = "int", paramType = "query"),
         @ApiImplicitParam(name = "cid", value = "当前客户id", required = false, dataType = "int", paramType = "query")
	})
	public Result<Integer> equivalent(int pid,int cid){
		return erpTpmsTireInformationService.equivalent(pid, cid);
	}
}
